<%--
    Document   : userPostHistory
    Created on : Apr 26, 2014, 10:02:17 PM
    Author     : Anton Strack
--%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@tag description="Set's the post's userHistoryState css class" pageEncoding="UTF-8"%>
<%@attribute name="postItemBean" type="csdwa.Post" required="true" %>
<%@ variable name-given="postHistoryStateClass" scope="AT_END"%>
<%@ variable name-given="postHistoryStateName" scope="AT_END"%>
<c:if test="${postItemBean != null}">
    <c:choose>
        <c:when test="${loggedIn == null}">
            <c:set var="postHistoryStateClass">
                csd_state-unknown
            </c:set>
            <c:set var="postHistoryStateName">
            </c:set>
        </c:when>
        <c:when test="${postItemBean.getDerivedInt('historyState') == 2}">
            <c:set var="postHistoryStateClass">
                csd_state-read
            </c:set>
            <c:set var="postHistoryStateName">
                <p class="pull-right badge csd_post-state">Read</p>
            </c:set>
        </c:when>
        <c:when test="${postItemBean.getDerivedInt('historyState') == 3}">
            <c:set var="postHistoryStateClass">
                csd_state-commented
            </c:set>
            <c:set var="postHistoryStateName">
                <p class="pull-right badge csd_post-state">Commented</p>
            </c:set>
        </c:when>
        <c:otherwise>
            <c:set var="postHistoryStateClass">
                csd_state-unread
            </c:set>
            <c:set var="postHistoryStateName">
                <p class="pull-right badge csd_post-state">Unread</p>
            </c:set>
        </c:otherwise>
    </c:choose>
</c:if>

